package implementor;

import daoInterface.BalancePaymentDao;
import dbhandeling.Crude;
import dto.BalancePayment;

public class BalancePaymentDaoImplementor extends Crude implements BalancePaymentDao
{
String className=new BalancePayment().getClass().getName();
@Override
public void add(BalancePayment balancepayment) throws Exception
{
insert(balancepayment);
}
/***********************************************************/
@Override
public void update(BalancePayment balancepayment) throws Exception
{
super.update(className,"totalAmt",balancepayment.gettotalAmt()+"","autoBalanceId",balancepayment.getautoBalanceId()+"");
super.update(className,"amtPaid",balancepayment.getamtPaid()+"","autoBalanceId",balancepayment.getautoBalanceId()+"");
super.update(className,"balanceDate",balancepayment.getbalanceDate()+"","autoBalanceId",balancepayment.getautoBalanceId()+"");
super.update(className,"type",balancepayment.gettype()+"","autoBalanceId",balancepayment.getautoBalanceId()+"");
}
/***********************************************************/
@Override
public void delete(BalancePayment balancepayment) throws Exception
{
super.delete(className,"autoBalanceId",balancepayment.getautoBalanceId()+"");
}
/***********************************************************/
@Override
public BalancePayment retrieve(String conditionField,String conditionValue) throws Exception
{
BalancePayment balancepayment=(BalancePayment) super.retreive(className,conditionField,conditionValue);
return balancepayment;
}
/***********************************************************/
@Override
public BalancePayment[] retrieveArray(String conditionField,String conditionValue) throws Exception
{
BalancePayment[] balancepayment;
Object[] obj=super.retreiveArrayOnCondition(className,conditionField, conditionValue);
balancepayment=new BalancePayment[obj.length];
for(int i=0;i<balancepayment.length;i++)
{
balancepayment[i]=(BalancePayment) obj[i];
}
return balancepayment;
}
/***********************************************************/
@Override
public BalancePayment[] retrieveAll() throws Exception
{
BalancePayment[] balancepayment;
Object[] obj=super.retreiveAll(className);
balancepayment=new BalancePayment[obj.length];
for(int i=0;i<balancepayment.length;i++)
{
balancepayment[i]=(BalancePayment) obj[i];
}
return balancepayment;
}
/***********************************************************/

public int getAutoGenratedKey()
{
	 int key=super.getAutoGenratedKey(className,"autobalanceId") ;
	 return key;
}

}
